<?php
  include ('header.php');
?>
<head>
<title><?php echo $titles['site_config']?></title>
</head>

<body>
<?php

if($_SESSION['access']<3)
{
DIE('Помилка: Ви не маєте права доступу до сату:');
}

if ($_GET[del]){
$sql="DELETE FROM users where id='".$_GET[del]."'";  
$process=mysql_query($sql, $db);
};
$u_access=array(
'1'=>'Користувач',
'2'=>'Редактор',
'3'=>'Адміністратор'
);
?>
<form name="edit_config"  method="POST">
<table class="IND_INVENTORY" width=50%>
<tr>

    <td class="IND_INVENTORY_C" width=20>ID</td>
	<td class="IND_INVENTORY_C" width=90>Логін</td>
	<td class="IND_INVENTORY_C">Доступ</td>
	<td class="IND_INVENTORY_C">Повне ім'я</td>
	<td class="IND_INVENTORY_C">Кабінет</td>
	<td class="IND_INVENTORY_C">телефон</td>
	<td class="IND_INVENTORY_C">Дія</td>

</tr>
<?php
$sql="select * from users";  
$process=mysql_query($sql, $db);
$i=1;
$j=0;
while ($row = mysql_fetch_array($process, $i)){
$j++;
	echo "<tr>";
	echo " <td class=\"IND_INVENTORY_C\" >".$row[id]."</td>";
	echo "<td class=\"IND_INVENTORY\">".$row[username]."</td>";
	
	echo "<td class=\"IND_INVENTORY_C\">".$u_access[$row[access]]." </td>";
	echo "<td class=\"IND_INVENTORY_C\">".$row[real_name]." </td>";
	echo "<td class=\"IND_INVENTORY_C\">".$row[cabinet]." </td>";
	echo "<td class=\"IND_INVENTORY_C\">".$row[tel]." </td>";
	echo "<td class=\"IND_INVENTORY_C\">
	<a href='".$_SERVER['PHP_SELF']."?del=".$row[id]."' onClick=\"return confirm('".$messages[config_name_delete].$row[config_name]."?');\"><img src=images/delete.png	border=0  width=20 height=20 onMouseOver=\"toolTip('".$actions['delete']."')\" onMouseOut=\"toolTip()\"></img></a>";
	echo "<a href='admin_edit_user.php?username=".$row[username]."'> <img src=images/new_card.png border=0  width=20 height=20 onMouseOver=\"toolTip('".$actions['edit_user']."')\" onMouseOut=\"toolTip()\"></a>";
	echo "</td></tr>";
}
$_SESSION["count_par"]=$j;

	echo "<div id=\"floatTip\"></div>";
?>
<tr><td colspan=6><input type="button" value="Новий запис" name="new" onClick="javascript:window.location='admin_edit_user.php';"></td></tr>
</table>

</form>
</body>
<?php
  include ('footer.php');
?>